package com.etc.controller;

import com.etc.entity.Checkout;
import com.etc.service.CheckOutService;
import com.etc.util.Layui;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/CheckoutController")
public class CheckoutController {
    @Autowired
    CheckOutService service;

    /**
     * 查询所有结算信息
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("/AllCheck")
    @ResponseBody
    public Layui AllCheck(@RequestParam(value = "page",defaultValue = "1")int page,
                        @RequestParam(value = "limit",defaultValue = "10")int limit){
        PageInfo<Checkout> pageInfo=service.getAllCHK(page,limit);
        return Layui.data(pageInfo.getTotal(),pageInfo.getList());
    }
}
